home *** CD-ROM | disk | FTP | other *** search
/ Programming in Microsoft Windows with C# / Programacion en Microsoft Windows con C#.iso / Original Code / Lines Curves and Area Fills / XMarksTheSpot / XMarksTheSpot.cs next >
Encoding:
Text File  |  2001-01-15  |  939 b   |  32 lines

  1. //--------------------------------------------
  2. // XMarksTheSpot.cs ⌐ 2001 by Charles Petzold
  3. //--------------------------------------------
  4. using System;
  5. using System.Drawing;
  6. using System.Windows.Forms;
  7.  
  8. class XMarksTheSpot: Form
  9. {
  10.      public static void Main()
  11.      {
  12.           Application.Run(new XMarksTheSpot());
  13.      }
  14.      public XMarksTheSpot()
  15.      {
  16.           Text = "X Marks The Spot";
  17.           BackColor = SystemColors.Window;
  18.           ForeColor = SystemColors.WindowText;
  19.           ResizeRedraw = true;
  20.      }
  21.      protected override void OnPaint(PaintEventArgs pea)
  22.      {
  23.           Graphics grfx = pea.Graphics;
  24.           Pen      pen  = new Pen(ForeColor);
  25.  
  26.           grfx.DrawLine(pen, 0, 0, 
  27.                              ClientSize.Width - 1, ClientSize.Height - 1);
  28.           grfx.DrawLine(pen, 0, ClientSize.Height - 1, 
  29.                              ClientSize.Width - 1, 0);
  30.      }
  31. }
  32.